/* eslint-disable func-names */
// eslint-disable-next-line import/no-extraneous-dependencies
import { Request, Response } from 'express';

const getFakeList = function(req: Request, res: Response) {
  const data = {
    number: 'T201912300003',
    status: 'Issued',
    code: 'B3R_DHE_K1002',
    key: 'MO201912300000',
    date: '12-25',
    number1: '300',
    number2: '5000',
    date1: '2-8',
    date2: '1-15',
  };
  const result = [] as any;
  const params = req.query as any;
  const { pageSize = 10 } = params;
  for (let i = 0; i < pageSize; i++) {
    result.push(JSON.parse(JSON.stringify(data)));
  }
  result[(Math.random() * 9).toFixed()].status = 'new';
  result[(Math.random() * 9).toFixed()].status = 'UnIssued';

  return res.json(result);
};

export default {
  'GET /_api/fake_plan_list': getFakeList,
};
